home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 49
/
049.d81
/
statistics analy
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
8KB
|
298 lines
10 gosub10000: gosub 500
100 printchr$(142)"[147][158] statistical analyzer by ian adam"
110 print"1 -- load data from disk"
120 print"2 -- create new data file"
130 print"3 -- save data to disk"
140 print"4 -- add to data"
150 print"5 -- edit current data"
160 print"6 -- change file name"
170 print"7 -- list data"
180 print"8 -- analyze data"
190 print"9 -- view normal distribution (example)"
200 print"10 - view poison distribution (example)"
210 print" (return) - return to loadstar"
230 if np then print"data function: "df$:print"points:"np
240 print"up to"mp"points available":print
250 print"[145]selection : [157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157]";
251 sys32768,2,4,a$:a=val(a$)
260 ifa<3andnpthenprint"loss of data: ok? :";:sys32768,1,2,a$:ifa$<"y"then100
270 :
400 on a+1 gosub 800,1000,2000,1200,2500,3000,1700,4000,5000,8000,8000
410 goto 100
420 :
500 print"[147]":mp=500:dim d(mp):rem max # points
510 dim cm(40),cl(40),ac(40),pl(40):poke53281,.
520 def fnl(a)=10^int(log(a)/log(10)-1)
530 def fnr(x)=l*int(x/l+.95):rem rounding
540 if peek(48)>9 then cr=679:for i=cr to 697:read s:poke i,s:next:return
550 data 32,241,183,32,241,183,138,72,32,241,183,138,168,104,170,24,76,240,255
560 :
620 :
800 print"[145] do you wish to quit to loadstar? (y/n)"
810 geta$:ifa$=""then810
811 ifa$="y"ora$="[217]"then900
820 ifa$="n"ora$="[206]"then100
821 goto 810
900 open15,8,15,"r0:hello connect=hello connect":input#15,er,er$:close15
901 ifer<>63 then print"[147]":end
905 load"hello connect",8,1
1000 print"[147]load data from disk"
1010 clr:gosub 500
1020 d$=",s,r":gosub 1500,open
1030 if a>19 then run
1040 :
1100 input#1,np
1110 for i=1 to np
1120 input#1,d(i)
1130 next:close 1
1140 gosub 1600:goto 100
1150 :
1200 d$=",s,w":print"[147]save data to disk"
1210 if np=0 then print"no data: press any key";:sys32768,1,128,a$:return
1220 print"press return for name: "df$
1230 gosub 1500,open
1240 if a>19 then return
1250 :
1300 print#1,np
1310 for i=1 to np
1320 print#1,d(i)
1330 next:close 1
1340 goto 1600
1350 :
1500 gosub 1700,name :rem open file
1510 d$="0:"+df$+d$
1520 close 2:open 2,8,15
1530 open 1,8,8,d$
1540 :
1600 input#2,a,b$:rem error check
1610 if a<20 then return
1620 print"problem: "b$:close 1
1630 if a-63 then print"press any key to continue";:sys32768,1,128,a$:return
1640 print"replace existing file (y/n):";:sys32768,1,2,a$
1650 if a$<"y" then return
1660 print#2,"s0:"+df$:goto 1530
1670 :
1700 print"name of file :";:sys32768,14,2,df$:print:rem set name
1710 if right$(df$,4)<>".sta" then df$=left$(df$,12)+".sta"
1720 return
1730 :
2000 :
2010 clr:gosub 500
2020 gosub 1700,name
2030 gosub 2500:goto 100
2040 :
2500 print"[147]enter new data points":print
2510 print"no negative values":print
2520 for i=np+1 to mp:print:print"enter value #"i
2530 print"data (return=quit)";:sys32768,6,12,a$:d(i)=val(a$)
2531 if a$=""then return
2540 if d(i)<0 then return
2550 an=0:np=i:next:return
2560 :
3000 print"press (return) or enter 0 to quit.
3010 :[153]
3020 p[178]0:[153]"point # to edit (0 quit)";:[158]32768,4,4,p$:p[178][197](p$)
3030 [139] p[179]1 [176] p[177]np [167] [142]
3040 [153] [163]5)d(p)
3050 [153]"ondata :";:[158]32768,6,4,a$:a[178][197](a$):[153]
3060 [139] d(p)[171]a [167] d(p)[178]a:an[178]0
3070 [137] 3020
3080 :
4000 i[178]1:p[178]21
4010 [153]"list data: screen or printer s/p? :";:[158]32768,1,2,p$
4011 [139]p$[178]"p"[167][159]15,4,15:[160]15:[139]st[179][177]0[167][153]"load-printer error-":[137]4010
4020 [139] p$[178]"p" [167] p[178]np:[159] 4,4:[157] 4
4030 [153]:[153]"data points for "df$
4040 :
4100 [153]"point data"
4110 [129] i[178]i [164] i[170]p
4120 [139] i[177]np [167] 4200
4130 [153]i [166]6[171][195]([196](i))) d(i)
4140 [130]
4150 :
4200 [139] p$[178]"p" [167] [152]4:[160] 4:[142]
4210 [153]"press any key to continue.";:[158]32768,1,128,a$:[153]
4220 [139] i[179]np [167] p[178]22:[137] 4100
4230 [142]
4240 :
5000 [139]np[179]2[167][153]"need more data: press any key.";:[158]32768,2,128,a$:[142]
5010 [153]"statistics: screen or printer s/p? :";:[158]32768,1,2,p$
5011 [139]p$[178]"p"[167][159]15,4,15:[160]15:[139]st[179][177]0[167][153]"load-printer error-":[137]5010
5020 [139] p$[178]"p" [167] [159] 4,4:[157] 4
5030 [153]:[153]"loaddata analysis":[153]:[153]
5040 [153]"data function: "df$
5050 [153]"number of points:"np
5060 [139] an [167] 5200:[143] previously analyzed
5100 mn[178]d(1):mx[178]0:t[178]0:s2[178]0
5110 [129] i[178]1 [164] np
5120 t[178]t[170]d(i):s2[178]s2[170]d(i)[172]d(i)
5130 [139] d(i)[179]mn [167] mn[178]d(i)
5140 [139] d(i)[177]mx [167] mx[178]d(i)
5150 [130]
5160 m[178]t[173]np:[143] mean
5170 s2[178](s2[171]t[172]t[173]np)[173](np[171]1):[143] variance
5180 sd[178][186](s2):[143] std deviation
5190 :
5200 [153]"loaddata minimum: "mn
5210 [153]"data maximum: "mx
5220 [153]"range: "mx[171]mn
5230 [153]"the mean is: "m
5240 [153]"sample variance: "s2
5250 [153]"std deviation: "sd
5260 [153]"coeff variation: "[181](1000[172]sd[173]m)[173]10"%"
5270 [153]"2/3 interval:"m[171]sd"to"m[170]sd
5280 [153]"95% interval:"m[171]2[172]sd"to"m[170]2[172]sd
5290 [139] p$[178]"p" [167] [152]4:[160] 4
5300 [139] an [167] 6000
5310 [139] us [167] 5420
5320 :
5400 nc[178][181]([186](3[172]np[170]4)):[139] nc[177]33 [167] nc[178]33: [143] set classes
5410 sp[178](mx[171]mn)[173](nc[171]1):l[178][165]l(sp):cm(1)[178][165]r(mn[171]sp[173]2)
5420 an[178]1:[141] 6600
5430 :
6000 [153]:[153]:[153]" 1 -- see statistics again":[143] analysis menu
6010 [153]" 2 -- list data by class"
6020 [153]" 3 -- define classes manually"
6030 [153]" 4 -- frequency histogram"
6040 [153]" 5 -- cumulative histogram"
6050 [153]" return-return to first menu"
6060 [153]:[153]"your choice :";:[158]32768,1,4,a$:a[178][197](a$):[153]
6070 [139] a[179]1 [167] [142]
6080 [145] a [137] 5000
6090 [145] a[171]1 [141] 9000,6500,7000,7500
6100 [137] 6000
6110 :
6500 us[178]1:[143] manual classes
6510 [153]"number of classes:"nc
6520 [153]"the first class starts at";cm(1)
6530 [153]"class width:"sp
6540 [153]:[153]"# classes (max 33)";:[158]32768,2,4,nc$:nc[178][197](nc$)
6550 [139] nc[179]2 [176] nc[177]33 [167] 6510
6560 [153]"new start:";:[158]32768,6,4,a$:cm(1)[178][197](a$)
6570 [153]"new width:";:[158]32768,6,4,a$:sp[178][197](a$)
6580 [139] sp[179][178]0 [167] 6570
6590 :
6600 l[178][165]l(sp):mc[178]cm(1)[171]sp:[153]:[153]"working":[143] classes
6610 [129] i[178]2 [164] nc[170]1
6620 cm(i)[178][165]r(mc[170]sp[172]i)
6630 cl(i[171]1)[178]0
6640 [130]
6650 :
6700 [129] i[178]1 [164] np:[143] put data in
6710 c[178](d(i)[171]mc)[173]sp:[139] c[177]nc [167] c[178]nc
6720 cl(c)[178]cl(c)[170]1:[130] i
6730 :
6800 ac(1)[178]cl(1):[143] accumulation
6810 [129] i[178]2 [164] nc
6820 ac(i)[178]ac(i[171]1)[170]cl(i)
6830 [130]:[142]
6840 :
7000 mc[178]0:[143] largest class
7010 [129] i[178]1 [164] nc
7020 [139] cl(i)[177]mc [167] mc[178]cl(i)
7030 [130]
7040 a[178][165]l(mc):s[178][165]r(mc):sc[178]0:[139]s[177]0[167]sc[178]20[173]s
7050 :
7100 [129] i[178]1 [164] nc:[143] scaling
7110 pl(i)[178]cl(i)[172]sc
7120 [130]
7130 a$[178]"frequency distribution "[170]df$
7140 [137] 7600
7150 :
7500 [129] i[178]1 [164] nc:[143] scale accum
7510 pl(i)[178]ac(i)[172]20[173]np
7520 [130]
7530 s[178]100:a$[178]"cumulative frequency "[170]df$
7540 :
7600 [153]"load"a$:[153]:[143] graphing routine
7610 a1$[178][199](207):[129] i[178]0 [164] 32:a1$[178]a1$[170][199](183):[130]
7620 a2$[178][199](17)[170][199](157)[170][199](165):a2$[178][199](165)[170]a2$[170]a2$
7630 [129] i[178]5 [164] 1 [169] [171]1
7640 [153] [202]([196](i[172]s[173]5),2,6)[163]5)a1$
7650 [153][163]5)a2$:[130]
7660 [153]"0"[163]5)a1$
7670 a[178]1[171](nc[179]17):a$[178][196](mx)
7680 [153] [163]5)mn [163]6[170]a[172]nc[171][195](a$)) a$ [199](150);
7690 :
7700 a3$[178][199](146)[170][199](162)
7710 a4$[178][199](18)[170]" "[170][199](145)[170][199](157)
7720 [129] i[178]1 [164] nc
7730 [139] pl(i)[179].1 [167] 7800
7740 [158] cr,0,22,5[170]a[172]i
7750 [139] pl(i)[179]1 [167] [153]a3$:[137] 7800
7760 [129] j[178]1 [